﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Barcode.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Barcode"
    xmlns:common="using:Barcode.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ads="using:Microsoft.Advertising.WinRT.UI"
    mc:Ignorable="d">

    <Grid Style="{StaticResource LayoutRootStyle}" Background="#F4981F">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Background="#2D42FF">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" x:Uid="appTitle" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}"/>
            <ads:AdControl Grid.Column="2" Width="728" Height="90" ApplicationId="8aa063cb-2c68-4b7d-ae7d-a9a8e4857525" AdUnitId="112143"/>
        </Grid>

        <Grid Grid.Row="1" Margin="50">

            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>

                <CaptureElement x:Name="previewCaptureElement"/>
                
                <StackPanel Grid.Column="1">
                    <ComboBox x:Name="camerasComboBox" ItemsSource="{Binding Cameras}" SelectionChanged="camerasComboBox_SelectionChanged">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=Name}"></TextBlock>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                    <ads:AdControl Grid.Column="2" Width="250" Height="125" ApplicationId="8aa063cb-2c68-4b7d-ae7d-a9a8e4857525" AdUnitId="110447" Margin="0, 25, 0, 0"/>

                    <TextBox x:Name="resultTextBox" x:Uid="resultTextBox" Margin="0, 50, 0, 0"/>
                    <Button x:Uid="copyButton" Margin="0, 50, 0, 0" Click="copyButton_Click"/>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</common:LayoutAwarePage>
